package com.itheima.String;

import java.util.Scanner;

public class UserWord {
    public static void main(String[] args) {
        String username = "张三";
        String password = "123456";
        Scanner sc = new Scanner(System.in);
        for (int i = 1; i <=3; i++) {
            System.out.println("请输入用户名:");
            String scUserName = sc.nextLine();
            System.out.println("请输入用户名:");
            String scPassWord = sc.nextLine();
            if(scUserName.equals(username) && scPassWord.equals(password)) {
                System.out.println("登陆成功");
                break;
            }else{
                    if (i == 3) {
                        System.out.println("您今日次数已用完,请明日再来!");
                    } else {
                        System.out.println("登陆失败,您还有" + (3 - i) + "次机会");
                    }
                }
            }
        }
    }

